package com.tanhua.model.vo;

import com.tanhua.model.pojo.TestOption;
import com.tanhua.model.pojo.TestQuestion;
import com.tanhua.model.pojo.Test;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class SoulVo implements Serializable {

    private String id;      //问卷id
    private String name;    //问卷名
    private String cover;   //封面
    private String level;   //级别(1初级, 2中级, 3高级)
    private Integer star;   //星别(2-5)

    private List<TestQuestionVo> questions;  //问题集合

    private Integer isLock = 0;     //是否锁住（0解锁，1锁住）
    private String reportId;    //最新报告id

    public static SoulVo init(Test test, List<TestQuestionVo> questions){
        SoulVo vo = new SoulVo();
        BeanUtils.copyProperties(test, vo);
        vo.setId(test.getId().toString());
        vo.setLevel(test.getLevel().toString());
        vo.setQuestions(questions);
        return vo;
    }
}
